package 类加载器.自定义类加载器;

import java.lang.reflect.Method;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO:
 * <P> Date: 2022/3/31:17:23
 * <P> Description:
 */

public class MyClassLoaderTest {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException {
        while (true) {


            try {
                MyClassLoader loader = new MyClassLoader("d:/");
                Class<?> clazz = loader.loadClass("Demo");
                Object o = clazz.newInstance();
                Method hot = clazz.getMethod("hot");
                Object invoke = hot.invoke(o);
                Thread.sleep(5000);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
//        System.out.println(clazz.getClassLoader().getClass().getName());
//        System.out.println(clazz.getClassLoader().getParent().getClass().getName());

    }
}
